package net.phoenix.repository.dao.mysql;

import java.io.IOException;
import java.sql.Blob;
import java.sql.SQLException;

import net.phoenix.repository.dao.BlobValueLoaderDao;

/**
 * 
* Jigsaw server
* 
* @author    <a href="shamphone@gmail.com">Li XiongFeng</a>
* @date      2012-9-30
* @version   1.0.0
 */
public class MysqlBlobValueLoaderDao  extends BlobValueLoaderDao{

	@Override
	public Blob load(String table, String column, String nodeId) throws SQLException, IOException {
		String SQL_SELECT1 = "select `"+column +"` from `" + table + "` where pkid=?";
		command = connection.prepareStatement(SQL_SELECT1);
		command.setString(1, nodeId);
		this.rs = command.executeQuery();
		if (rs.next()) {
			Blob blob = rs.getBlob(1);
			return blob;
		}
		return null;
	}
}
